package cn.waka.sys.admin.controller;

import cn.waka.sys.admin.object.Result;

public abstract class BaseController {

	
	public Result login(){
		return error(-403,"沒有登錄");
	}

	public Result ok(){
		return new Result();
	}
	public Result ok(Object obj){
		Result rs=new Result();
		rs.setData(obj);
		
		return rs;
	}
	
	public Result ok(Object data,String url){
		Result rs=new Result();
		rs.setCode(0);
		rs.setUrl(url);
		rs.setData(data);
		return rs;
	}
	
	public Result error(int code,String msg){
		Result rs=new Result();
		rs.setCode(code);
		rs.setMsg(msg);
		return rs;
	}
	
	public Result back(Object obj,int code,String msg){
		Result rs=new Result();
		rs.setData(obj);
		rs.setCode(code);
		rs.setMsg(msg);
		return rs;
	}
}
